From 55ade04e115e81851aa4cc9ee038509e60cb7bbc Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Fri, 5 Oct 2012 18:45:37 +0200 Subject: [PATCH] animations: Don't set animated values for finished transitions Otherwise, that value will never get reset and remain frozen in time. This is problematic for example when the value is inherited and the parent changes the value. --- gtk/gtkcsstransition.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/gtk/gtkcsstransition.c b/gtk/gtkcsstransition.c index bbd2dccae3..08db4285fc 100644 --- a/gtk/gtkcsstransition.c +++ b/gtk/gtkcsstransition.c @@ -38,9 +38,7 @@ gtk_css_transition_set_values (GtkStyleAnimation *animation, if (transition->start_time >= for_time_us) value = _gtk_css_value_ref (transition->start); - else if (transition->end_time <= for_time_us) - value = _gtk_css_value_ref (end); - else + else if (transition->end_time > for_time_us) { progress = (double) (for_time_us - transition->start_time) / (transition->end_time - transition->start_time); progress = _gtk_css_ease_value_transform (transition->ease, progress); @@ -52,9 +50,14 @@ gtk_css_transition_set_values (GtkStyleAnimation *animation, if (value == NULL) value = _gtk_css_value_ref (end); } + else + value = NULL; - _gtk_css_computed_values_set_animated_value (values, transition->property, value); - _gtk_css_value_unref (value); + if (value) + { + _gtk_css_computed_values_set_animated_value (values, transition->property, value); + _gtk_css_value_unref (value); + } } static gboolean -- 2.30.2